#{extends 'main.html' /}

#{set title:'Liste des stages' /}

#{if stages}
    <div class="post">
        <div class="post">
            <h2 class="post-title">
                Liste des stages
            </h2>
            <br>
            <table cellpadding="0" cellspacing="0" border="0" class="display" id="liste"> 
        		<thead>
        			<tr>
        				<th>Intitule</th>	
        				<th>Code</th>
        				<th>Nature</th>
        				<th>Structure Organisatrice</th>
        				<th>Durée</th>
        				<th>Lieu</th>
        				<th>Date de Début</th>
        				<th>Etat</th>
        				<th>Inscrit</th>
        				<th>Liste d'Attente</th>
        				<th>Annulé</th>
        				<th>Jury</th>
        				<th>Formateur</th>
        				<th>Candidatures</th>
        			</tr>
        		</thead>		

                <tbody>
        	    #{list items:stages, as:'stage' } 
        	       <tr>
        	            <td>${stage.intitule}</td>
        	            <td><a href="@{Stages.detailStage(stage.id)}">${stage.code}</a></td>        	            
        	            <td>${stage.nature}</td>
        	            <td>${stage.structure}</td>
        	            <td>${stage.duree} Jour(s)</td>
        	            <td> 
                            #{if stage.lieu == null}
                                -
        	                #{/if}
                            #{else}
        	                    ${stage.lieu}
                            #{/else}
        	            </td>
        	            <td> 
                            #{if stage.dateDeb == null}
                                -
        	                #{/if}
                            #{else}
        	                    ${stage.dateDeb.format('dd MMMM yyyy', 'fr')}
                            #{/else}
        	            </td>
        	            <td>${stage.etat}</td>
        	            <td>${stage.getEffectif()} / ${stage.effectifMax}</td>
        	            <td>${stage.getEffectifListeAttente()}</td>
        	            <td>${stage.getEffectifAnnule()}</td>
        	            <td>${stage.getNombreJury()}</td>
        	            <td>${stage.getNombreFormateur()}</td>
        	           <td>
        	               <a href="@{Candidats.validation(stage.id)}">Valider</a> |
        	               <a href="@{Candidats.listeAttente(stage.id)}">Liste d'Attente</a> |
        	               <a href="@{Candidats.annulation(stage.id)}">Annuler</a> |
           	               <a href="@{Candidats.ajouterCandidature(stage.id)}">Ajouter</a>
        	               
        	           </td>
        	       </tr>
        	       
        	       
        	    #{/list}
        	    </tbody>
        	</table>
        </div>
    </div>    
#{/if}
 
#{else}
    <div class="empty">
        There is currently nothing to read here.
    </div>
#{/else}
